const path = require("path");

const resolve = function (dir) {
    return path.resolve(__dirname, dir);
}

module.exports = {
    publicPath: "./",
    lintOnSave: false,
    css: {
        loaderOptions: {
            less: {
                data: `@import "@styles/vars.less"`
            },
            postcss: {
                plugins: [
                    require("autoprefixer")(),
                    require('postcss-pxtorem')({
                        rootValue: 50,
                        minPixelValue: 2,
                        mediaQuery:true,
                        propList:["*"]
                        // propBlackList: ['border']
                    }), // 换算的基数
                ]
            }
        }
    },
    chainWebpack: config => {
        config.resolve.alias
            .set("@", resolve("src"))
            .set("@core", resolve("core"))
            .set("@styles", resolve("core/styles"))
            .set("@comp",resolve("src/components"))
    },
    pluginOptions: {
        "style-resources-loader": {
            preProcessor: "less",
            patterns: [path.resolve(__dirname, "./core/styles/vars.less")]
        }
    }
};